import {
  createTopAvatar,
  createTopInfo,
} from "@/content-scripts/components/person/person";

// import { fundValuation } from "@/content-scripts/components/person/funds/funds";

export function observePersonElements() {
  const observer = new MutationObserver(() => {
    const topAvatar = document.querySelectorAll('.iuOKf');
    // console.log(topAvatar, "topAvatar");
    if (topAvatar) {
      createTopAvatar();
    }
    const topEmail = document.querySelectorAll(".iNVHYx");
    // console.log(topEmail, "topEmail");
    if (topEmail) {
      console.log("topEmail");

      createTopInfo();
    }
  });
  observer.observe(document.body, {
    childList: true,
    subtree: true,
    attributes: true,
    characterData: true,
  });
}

// export function observeFundElements() {
//   const observer = new MutationObserver(() => {
//     const originalTotal = document.querySelector(
//       "#valuation-total-funds > .hidden-funds-num"
//     );
//     const originalTotalBTC = document.querySelector(
//       ".valuation-exchange > .hidden-funds-num"
//     );
//     if (originalTotal) {
//       fundValuation();
//     }

//     if (originalTotalBTC) {
//       fundValuation();
//     }
//   });
//   observer.observe(document.body, {
//     childList: true,
//     subtree: true,
//     attributes: true,
//     characterData: true,
//   });
// }
